﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace teach
{
    /// <summary>
    /// The panel to start a video
    /// </summary>
    public partial class PlayerPanel : PanelBase
    {
        public event EventHandler MovieEnded;

        public PlayerPanel()
        {
            InitializeComponent();
        }

        public void StartVideo(string url)
        {
            player.URL = url;
            player.stretchToFit = true;
            player.Ctlcontrols.play();
        }

        public void StopVideo()
        {
            player.Ctlcontrols.stop();
        }

        private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                MovieEnded(this, null);
            }
        }
    }
}
